# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=kgpg
pkgver=24.02.2
pkgrel=0
# armhf blocked by extra-cmake-modules
# ppc64le, s390x and riscv64 blocked by qt5-qtwebengine -> akonadi-contacts
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://kde.org/applications/utilities/org.kde.kgpg"
pkgdesc="A simple interface for GnuPG, a powerful encryption utility"
license="GPL-2.0-or-later"
makedepends="
	akonadi-contacts-dev
	extra-cmake-modules
	gpgme-dev
	karchive-dev
	kcodecs-dev
	kcontacts-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdoctools-dev
	ki18n-dev
	kiconthemes-dev
	kio-dev
	kjobwidgets-dev
	knotifications-dev
	kservice-dev
	kstatusnotifieritem-dev
	ktextwidgets-dev
	kwidgetsaddons-dev
	kwindowsystem-dev
	kxmlgui-dev
	qt6-qtbase-dev
	samurai
	"
_repo_url="https://invent.kde.org/utilities/kgpg.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/kgpg-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# kgpg-import fails too often
	# kgpg-encrypt and kgpg-export are broken
	# del-key fails randomly
	# genkey fails on arm on builders
	ctest --test-dir build --output-on-failure -E "kgpg-(genkey|import|encrypt|export|del-key)" -j1
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
487330bdb2999402db566b2c5ea843c527848361d82d0463465b1a8b53fe349910e5276b7605ff95117bf10903f477dcf253f66a841142074d543e66585f1a57  kgpg-24.02.2.tar.xz
"
